<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>组件参数校验与非props特性</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <child content="hello world"></child>
    </div>

    <script>
        Vue.component('child', {
            props: {
                // content: [Number, String, Object]
                content: {
                    type: String,
                    // required: false,
                    // default: '没有传值'
                    validator: function(value) {
                        return value.length > 5
                    }
                }
            },
            template: '<div>{{content}}</div>'
        })
        var vm = new Vue({
            el: '#app',
            data: {

            }
        })
    </script>
</body>
</html>